﻿if (typeof (Seq) == 'undefined') Seq = new Object();

if (typeof (Seq.Common) == 'undefined') Seq.Common = new Object();

var randomprefix = '';
var randomindex = 0;

Seq.Common.GetKeyName = function(n) {
	var oN = Math.floor(n / 12);
	var oK = n % 12;
	var nB = ['C-', 'C#', 'D-', 'D#', 'E-', 'F-', 'F#', 'G-', 'G#', 'A-', 'A#', 'B-'];
	return nB[oK] + oN;
}

Seq.Common.GetRandomID = function(prefix) {
	if (randomprefix == '') {
		randomprefix = '';
		for (var k = 0; k < 6; k++)
			randomprefix += Math.round(Math.random() * 9).toString();
	}
	var id = prefix + randomprefix;
	for (var k = 0; k < 6; k++)
		id += Math.round(Math.random() * 9).toString();
	id += randomindex.toString();
	randomindex++;
	return id;
}